<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="taskInfoList">
      <el-table-column label="任务ID" align="center" prop="id" />
      <el-table-column label="价格" align="center" prop="priceAmount" />
      <el-table-column label="任务描述" align="center" prop="descInfo" />
      <el-table-column label="推送时间" align="center">
        <template slot-scope="scope">
          {{ scope.row.starttime || '' }}-{{ scope.row.endtime || '' }}
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center">
        <template slot-scope="scope">
          <span :style="{ color: scope.row.status === 0 ? 'red' : 'green' }">
            {{ scope.row.status === 0 ? '关' : '开' }}
          </span>
        </template>
      </el-table-column>

    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

  </div>
</template>

<script>
import { listTaskInfo } from "@/api/merchantdata/merchatInfo";

export default {
  name: "TaskInfo",
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商户推送任务表格数据
      taskInfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },

      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询商户推送任务列表 */

    getList() {
      this.loading = true;
      listTaskInfo(this.queryParams).then(response => {
        this.taskInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },

  },
};
</script>
